#include <iostream>
using namespace std;

class Date
{
	public:
			Date(int year = 1, int month = 1, int day = 1)
 	{
		 _year = year;
		 _month = month;
		 _day = day;
	}
		void Print() const 
	{
		printf("%04d-%02d-%02d\n",_year,_month,_day);
	}

	private:
		int _year;
		int _month;
		int _day;
};
int GetMonthDay(int year, int month)
{
	 static int MonthDay[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
	 if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
	 {
		 return 29;
	 }
	 else
	 {
		 return MonthDay[month];
	 }

}
int main()
{
	int year,day;
	int month=1;
	cin>>year>>day;
	while(day>GetMonthDay(year,month))
	{
		day-=GetMonthDay(year,month);
		month++;
	}
	Date d1(year,month,day);
	d1.Print();
	
}
